package com.nbsaas.boot.manufacturing.rest.resource;

import com.nbsaas.boot.manufacturing.api.apis.BomItemApi;
import com.nbsaas.boot.manufacturing.data.entity.BomItem;
import com.nbsaas.boot.manufacturing.api.domain.request.BomItemRequest;
import com.nbsaas.boot.manufacturing.api.domain.response.BomItemResponse;
import com.nbsaas.boot.manufacturing.api.domain.simple.BomItemSimple;
import com.nbsaas.boot.manufacturing.rest.convert.BomItemSimpleConvert;
import com.nbsaas.boot.manufacturing.rest.convert.BomItemEntityConvert;
import com.nbsaas.boot.manufacturing.rest.convert.BomItemResponseConvert;
import com.nbsaas.boot.manufacturing.data.repository.BomItemRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   BOM项目-业务接口实现
*/
@Transactional
@Service
public class BomItemResource extends BaseResource<BomItem,BomItemResponse, BomItemSimple, BomItemRequest>  implements BomItemApi {

    @Resource
    private BomItemRepository bomItemRepository;

    @Override
    public JpaRepositoryImplementation<BomItem, Serializable> getJpaRepository() {
        return bomItemRepository;
    }

    @Override
    public Function<BomItem, BomItemSimple> getConvertSimple() {
        return new BomItemSimpleConvert();
    }

    @Override
    public Function<BomItemRequest, BomItem> getConvertForm() {
        return new BomItemEntityConvert();
    }

    @Override
    public Function<BomItem, BomItemResponse> getConvertResponse() {
        return new BomItemResponseConvert();
    }




}


